package cn.cslg.tieba.domain.dao;

import cn.cslg.tieba.domain.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

/**
 * @author Wu Zhenwei
 * 2017/11/21
 */
@Mapper
public interface UserDao {

    @Select("select * from user where userId = #{id}")
    User findById(Integer id);

    @Insert("insert into user(username,password) values(#{username},#{password})")
    @Options(useGeneratedKeys = true, keyColumn = "userId", keyProperty = "userId")
    void insert(User user);
}
